<template>
	<view>
		<view class="mode">
			<u-form :model="form" ref="uForm">
				<u-form-item label="售后原因" label-width="150" prop="account">
					<u-input v-model="form.account" placeholder="请输入售后原因" />
				</u-form-item>
				
			</u-form>
		</view>


		<view class="mode">

			<u-cell-item title="售后凭证" value="请上传您的售后原因" :border-bottom="false" :arrow="false"></u-cell-item>
			<upload_img ref="videoUpload" type="image" @uploaded="uploaded" :afterLoadUrl="form.image_url" defaultLength="6"></upload_img>
		</view>


		<u-button shape="circle"
			:custom-style="{background:'#628DFF',color:'#fff',marginTop:'40rpx',width:'500rpx',marginBottom:'40rpx'}"
			@click="submit">
			提交审核</u-button>
  <u-toast ref="uToast" />
	</view>
</template>

<script>
	import upload_img from '../../components/upload_img.vue';
	export default {
		components: {
			upload_img
		},
		data() {
			return {
			    id:"",
				form: {
					account: '',
					name: '',

				},
				rules: {
					name: [{
						required: true,
						message: '请输入您的真实姓名',
						// 可以单个或者同时写两个触发验证方式 
						trigger: ['change', 'blur'],
					}],
					account: [{
						required: true,
						message: '请输入您的账号',
						// 可以单个或者同时写两个触发验证方式 
						trigger: ['change', 'blur'],
					}]
				}
			}
		},
		methods: {
			submit() {
				
				this.$refs.uForm.validate(valid => {
					if (valid) {
						
					this.$u.post('/api/indent/refund', {
						order_id:this.id,
						remark:this.form.account,
						image:this.$refs.videoUpload.afterUploadImgList
					}, {}).then(res => {	
						console.log(111)
						console.log(res)
						  this.$refs.uToast.show({
						  		title: '提交成功',
						  		type: 'success',
								
						  })
					
					}).catch(err => {})
					
				
					} else {
						console.log('验证失败');
					}
				});
			}

		},
		onReady() {
			this.$refs.uForm.setRules(this.rules);
		},
		onLoad(options) {
			if(options.id){
				this.id=options.id
			}
			
		}
	}
</script>

<style lang="scss">
	@import '../../pages/my/common.css';
</style>
